//
//  LMSBaseViewController.m
//  LMS
//
//  Created by ChangFrank on 2017/10/11.
//  Copyright © 2017年 dfws. All rights reserved.
//

#import "LMSBaseViewController.h"
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <SDWebImage/UIImageView+WebCache.h>
#import <SDWebImage/UIImage+MultiFormat.h>
#import "LMSBaseViewController.h"


#import <MJRefresh/MJRefresh.h>

#import <MJExtension/MJExtension.h>



//统计组件
//#import <UMErrorCatch/UMErrorCatch.h>
//#import "UIView+quick.h"//whAfter
#import "DemoHelp.h"
#import "Masonry.h"
//#import "LMSNewAPIClient.h"

@interface LMSBaseViewController ()

@end

@implementation LMSBaseViewController
// 支持设备自动旋转
- (BOOL)shouldAutorotate
{
    return YES;
}


- (void)createBackBtn
{
    //自定义左边 的按钮
    UIImage* image= [UIImage imageNamed:@"common_goBack"];
    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
    CGRect backframe= CGRectMake(-20, 0, 30, 30);
    UIButton* backButton= [UIButton buttonWithType:UIButtonTypeCustom];
    backButton.frame = backframe;
    [backButton setImage:image forState:UIControlStateNormal];
    [view addSubview:backButton];
    backButton.titleLabel.font=[UIFont systemFontOfSize:12];
//    [backButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -backButton.imageView.size.width, 0, backButton.imageView.size.width)];
    [backButton setImageEdgeInsets:UIEdgeInsetsMake(0, backButton.titleLabel.bounds.size.width, 0, -backButton.titleLabel.bounds.size.width)];
    [backButton addTarget:self action:@selector(popToLastVC) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:view];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
//    解决按钮不靠左 靠右的问题.
//    UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
//                                                                                  target:nil action:nil];
//    nagetiveSpacer.width = -50;//这个值可以根据自己需要自己调整
//    self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftBarButtonItem];
}
- (void)popToLastVC
{
    [self.view endEditing:YES];
    [self.navigationController popViewControllerAnimated:YES];
}
//-(UIStatusBarStyle)preferredStatusBarStyle
//{
//    return UIStatusBarStyleLightContent;
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
